$(function(){
	var banImg = new Array();
	$banImg =$(".ibanImg");
	var getImgSrc =function(){
		$('<div class="banNum"></div>').appendTo(".banFn");
		var i=0;
		$banImg.children("li").each(function(){
		banImg[i] = $(this).children().attr("src");	
		$('<a href="">'+(i+1)+'</a>').appendTo(".banNum");
		i++;
		});	
		return banImg;
	}
	getImgSrc();
	var dots = 0;
	var speed =5000;
	var fadeSpeed =800;
	var timer = null;
	$(".banNum a").eq(0).addClass("dots")
	var changeBan =function(dots){
		if(dots>=$banImg.children().length-1){
			dots=0;
			}
		else{
			dots++;
			}	
		var $screen =$(".iBanScreen");
		
		$screen.hide().css({"background-image":"url("+banImg[dots]+")"}).fadeIn(fadeSpeed);
		$(".banNum a").eq(dots).addClass("dots").siblings().removeClass("dots");
		autoChange(dots);
		}
	var autoChange =function(dots){
		timer = setTimeout(function(){
			changeBan(dots);							
		},speed);
		}	
	autoChange(dots);
	$(".banNum a").click(function(){
		clearTimeout(timer);							  
		var index = $(this).index()-1;
		changeBan(index);
		return false;
	});
});